//
//  MaskView.m
//  Xiaomakuaixiu
//
//  Created by SunChao on 2018/4/11.
//  Copyright © 2018年 hwd. All rights reserved.
//

#import "MaskView.h"
#import "QShowSubAlertView.h"
@interface MaskView()
{
    UIControl *_maskView;
    QShowSubAlertView *_subView;
    
    CGFloat W;
    CGFloat H;
    
}
@end

@implementation MaskView

- (void)test{
    
    _maskView = [[UIControl alloc] initWithFrame:[UIScreen mainScreen].bounds];
    _maskView.backgroundColor = [UIColor colorWithWhite:0.1 alpha:0.5];
    
    _subView = [[[NSBundle mainBundle] loadNibNamed:@"QShowSubAlertView" owner:nil options:nil] lastObject];
    
    
    W = SCREEN_WIDTH-100;
    H = 240;
    _subView.frame = CGRectMake((SCREEN_WIDTH-W)/2, SCREEN_HEIGHT, W,H);
    _subView.layer.cornerRadius = 10.0f;
    _subView.layer.masksToBounds = YES;
    [_maskView addSubview:_subView];
    UIWindow *window = [[UIApplication sharedApplication].delegate window];
    [window addSubview:_maskView];
    [UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:0.6 initialSpringVelocity:1 options:UIViewAnimationOptionCurveLinear animations:^{
        _subView.center = self.center;
        _maskView.alpha = 1;
    } completion:^(BOOL finished) {
        
    }];
    
}

@end
